import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

//查询日志列表
export function listLog(data) {
  return request({
    url: '/admin/logs',
    method: 'post',
    data: data
  })
}

//根据日期范围查询
export function getLogByDate(data) {
  return request({
    url: '/admin/getLogByDate',
    method: 'post',
    data: data
  })
}

//根据id查询日志
export function getLog(id) {
  return request({
    url: '/admin/log/' + id,
    method: 'get',
  })
}

//新增日志
export function addLog(data){
  return request({
    url: '/admin/log',
    method: 'post',
    data: data
  })
}

//修改日志
export function updateLog(data) {
  return request({
    url: '/admin/log',
    method: 'put',
    data: data
  })
}

//删除应用
export function delLog(id) {
  return request({
    url: '/admin/log/' + id,
    method: 'delete',
  })
}

//批量删除
export function delLogs(ids) {
  return request({
    url: '/admin/logs',
    method: 'delete',
    data: ids
  })
}

//导出日志
export function exportLog(data) {
  return request({
    url: '/admin/logs/download',
    method: 'post',
    data: data,
    headers: {
      Accept: 'application/json',
      'Content-Type': 'application/json; charset=utf-8',
      withCredentials: true,
    },
    responseType: 'arraybuffer',//防止乱码
  })
}
